package jp.co.cos.ittrick.channel.controller;

import java.util.List;

import jp.co.cos.ittrick.channel.model.ApplicationModel;
import jp.co.cos.ittrick.channel.model.ArticleModel;
import jp.co.cos.ittrick.channel.model.ChannelModel;
import jp.co.cos.ittrick.channel.service.ApplicationService;
import jp.co.cos.ittrick.channel.service.ArticleService;
import jp.co.cos.ittrick.channel.service.ChannelService;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

public class SitemapsController extends Controller {

    private ApplicationService applicationService;
    private ChannelService channelService;
    private ArticleService articleService;

    public SitemapsController() {
        applicationService = new ApplicationService();
        channelService = new ChannelService();
        articleService = new ArticleService();
    }

    @Override
    public Navigation run() throws Exception {

        ApplicationModel applicationModel = applicationService.getApplicationModel();
        requestScope("applicationModel", applicationModel);

        List<ChannelModel> channelList = channelService.getAll();
        requestScope("channelList", channelList);

        List<ArticleModel> articleList = articleService.getPublicArticleList();
        requestScope("articleList", articleList);

        return forward("sitemaps.jsp");
    }
}
